package com.sskj.gocoin.utils;

import android.text.TextUtils;

/**
 * <pre>
 *     author : 吕志豪
 *     e-mail : 1030753080@qq.com
 *     time   : 2018/04/04
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class PhoneHideUtil {
    public static String getHide(String mobile) {
        if (TextUtils.isEmpty(mobile)) {
            return "";
        }
        return mobile.substring(0, 3) + "****" + mobile.substring(7, 11);
    }

    /**
     * 邮箱**
     */

    public static String getEmailHide(String email) {
        if (TextUtils.isEmpty(email)) {
            return "";
        }
        String returnEmail = "";
        String emailStart = email.split("@")[0];
        if (emailStart.length() <= 4) {
            returnEmail = "**@" + email.split("@")[1];
        } else {
            returnEmail = emailStart.substring(0, 2) + "**" + emailStart.substring(emailStart.length() - 2, emailStart.length()) + "@" + email.split("@")[1];
        }
        return returnEmail;
    }
}
